package mulegame;

import javax.swing.*;
/**
 * Controls the timer and displays it on the screen as a test
 * 
 * @author AREA 29
 *
 */
public class TimedScreenTest extends TimedScreen{
    private JLabel label;
    private int count;
    /**
     * sets graphic control object and duration 
     * 
     * @param ctrl graphic controller ctrl
     * @param duration duration of turn
     */
    public TimedScreenTest(GraphicsControl ctrl, int duration){
        super(ctrl, duration);   
    }
    
    /**
     * makes a panel and lets it last for a set amount of time
     */

    protected void makePanel(){
       label = new JLabel("unset");
       add(label);
       count = ((int)duration)/1000;
    }
    
    /**
     * Displays the timer and decrements 
     */
    @Override
    public void timerTick(){
        Logger.println("TimedScreenTest's timerTick called");
        String labeltext = new Integer(count).toString();
        label.setText(labeltext);
        count--;
    }
}
